/* 
 * @description: //Appbar 相关组件
 * @author: Jane 
 * @date: 2023-09-13 14:53:43
 */

import 'package:basic_common/app_theme.dart';
import 'package:basic_common/common_exports.dart';

/// APPbar 默认
PreferredSizeWidget mainAppbar({required String title,bool titleCenter=false,List<Widget>? actions}) {
  return AppBar(
      backgroundColor: AppTheme.appBgColor,
      elevation: 0,
      title: Text(
        title,
        style: TextStyle(
            color: AppTheme.dartTextColor, fontSize: ScreenHelper.sp(18)),
      ),
      centerTitle: titleCenter,
      automaticallyImplyLeading: false,
      flexibleSpace: Container(
        decoration: const BoxDecoration(
          gradient: LinearGradient(colors: [
            Color(0xFFEAFFF8),
            Color(0xFFF7F7F7),
          ], begin: Alignment.topCenter, end: Alignment.bottomCenter),
        ),
      ),actions: actions);
}

/// 带返回按钮 appBar
/// title 标题
PreferredSizeWidget backAppbar({String title = '',List<Widget>? actions}) {
  return AppBar(
    elevation: 0,
    leading: GestureDetector(
      onTap: () => Get.back(),
      child: Icon(
        Icons.arrow_back_ios,
        size: ScreenHelper.width(29),
        color: AppTheme.dartTextColor,
        weight: 200,
      ),
    ),
    title: Text(
      title,
      style: TextStyle(
          color: AppTheme.dartTextColor, fontSize: ScreenHelper.sp(18)),
    ),
    centerTitle: true,
    actions: actions,
  );
}

